package graph.paint;

import org.eclipse.swt.graphics.Rectangle;

public class ViewPort {
	public double lox, hix,loy,hiy;
	public Rectangle rect;
	public ViewPort(double lox, double hix, double loy, double hiy) {
		this.lox = lox;
		this.hix = hix;
		this.loy = loy;
		this.hiy = hiy;
	}
	public void setArea(Rectangle r) { rect = r; }
	public int[] viewPos(double x, double y) {
		int[] result = {
				(int) ((x-lox)/(hix-lox)*rect.width),  
				(int) ((y-loy)/(hiy-loy)*rect.height)  
		};
		return result;
	}
}
